#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int cmp(const void* a,const void* b)
{
	return *(int*)a < *(int*)b;
}
int thirdMax(int* nums, int numsSize) 
{
	qsort(nums, numsSize, sizeof(int), cmp);
	int mid = 0;
	for (int i = 1; i < numsSize; i++)
	{
		if (nums[i] != nums[i - 1] && ++mid == 2)
			return nums[i];
	}
	return nums[0];

}
int main()
{
	int num[10] = { 3,3,2,4,1,1,5 };
	int ret = thirdMax(num, 7);
	printf("%d\n", ret);
	return 0;
}